@echo off
setlocal enabledelayedexpansion
set "SUFFIX=.jar"
set binPath=%~dp0
cd ..
set "SEARCH_PATH=%cd%

echo %binPath%;
echo %SEARCH_PATH%;

echo Searching for files with %SUFFIX% extension in %SEARCH_PATH%...
set "firstFile="
for  %%f in (*%SUFFIX%) do (
   if not defined firstFile (
        set "firstFile=%%f"
        echo the first jar file: !firstFile!
    )
)

if not defined firstFile echo Not found file!
endlocal

pause